<?php
if (!defined('CMS_SYSTEM')) die();
if ($disable_site) {
	echo "<center style=\"margin-top:200px;font-weight:bold\">".$disable_message ."</center>";
}else{
global $db,$Default_Temp, $time, $currentlang,$prefix;
if (file_exists(DATAFOLD."/config_introduce.php")) {
	include_once(DATAFOLD."/config_introduce.php");
}
include_once("templates/".$Default_Temp."/header.php");
  include_once("templates/".$Default_Temp."/banner.php");
  include_once("templates/".$Default_Temp."/menu.php");
  /*
   * Phan lay ra chi tiet san pham
   * Le duc vien
   */
    $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
	$result = $db->sql_query("SELECT p.title, p.description, p.images,p.price, c.catid, c.title, c.parentid FROM ".$prefix."_products AS p,".$prefix."_products_cat AS c WHERE p.id='$id' AND p.catid=c.catid AND p.alanguage='$currentlang'");
	if(empty($id) || $db->sql_numrows($result) != 1) {
		header("Location: ".url_sid("index.php?f=$module_name")."");
		exit();
	}
	list($title, $description, $images,$price, $catid, $catname, $parentid) = $db->sql_fetchrow($result);
	$header_page_keyword = $description;
	$db->sql_query("UPDATE ".$prefix."_products SET hits=hits+1 WHERE id='$id'");
	if($parentid != 0) {
		$title_cat = page_tilecat($catid, $parentid, $catname);
		$page_title .= "".$title_cat." :: ".$title."";
	} else {
		$title_cat = $catname;
		$page_title .= " :: ".$catname." :: ".$title."";
	}
 echo "<div id=\"wrapper\">";
	 echo "<div class=\"content fix\">";
	     //Noi dung phan loc tat ca san pham
	     echo "<div class=\"w720 fl\">";
	       echo "<div class=\"common\">";
	            echo "<div class=\"title\">";
							echo "<div class=\"text\"><a href=\"".url_sid("index.php?f=products&do=categories&catid=$catid")."\"><span>$catname</span></a><span class=\"sep\"></span><span>$title</span></div>";
				echo "</div>";
			    echo "<div class=\"wrap fix\">";
			       //phan lay ra thong tin chi tiet san pham
			       echo "<div class=\"detail\">";
			           echo "<h1 class=\"head\">$title</h1>";
						   echo "<div class=\"info\">";
						      if($images=="")
						      {
						       echo "<img src=\"images/nopic2.gif\" class=\"pic_product\"/>";
						      }else{
								 echo "<img src=\"$path_upload/$module_name/$images\" class=\"pic_product\"/>";}
						   echo "</div>";
						   echo "<div class=\"info\">"._PRICE_PRODUCT.": <strong class=\"f1\">".bsVndDot($price)." VNĐ</strong></div>";
						   echo "<div class=\"info\"><a href=\"".url_sid("index.php?f=products&do=cart&act=add&id=$id")."\" class=\"btnBuy\">"._CART_PRODUCT."</a></div>";
                       echo "<p>";
                        echo "<span>$description</span>";
                       echo "</p>";
				echo "</div>";
			       //ket thuc phan lay thong tin
			    echo "</div>";
	       echo "</div>";
	     echo "</div>";
	     include_once("templates/".$Default_Temp."/rightbody.php");
	 echo "</div>";
	 themeSlideShow(8);
	 themeFooter();
 echo "</div>";
 /*
  * Ket thuc phan san pham
  * 
  */
include_once("templates/".$Default_Temp."/footer.php");
}
?>